package com.tecnalia.authz.common.request;

import org.jboss.security.xacml.interfaces.RequestContext;

import com.tecnalia.authz.common.log.PDPLog;
import com.tecnalia.authz.common.request.contur.IRequestContur;
import com.tecnalia.authz.common.request.contur.RequestConturImpl;
import com.tecnalia.authz.common.request.xacml.IXACMLRequest;
import com.tecnalia.authz.common.request.xacml.XACMLRequestImpl;

public class Request implements IXACMLRequest,IRequestContur{

	private PDPLog logger = new PDPLog(Request.class);

	private IXACMLRequest xacmlRequest = null;
	private IRequestContur requestContur = null;

	public Request(){
		xacmlRequest = new XACMLRequestImpl();
		requestContur = new RequestConturImpl();
	}

	@Override
	public RequestContext getRequestContext() {
		return this.requestContur.getRequestContext();
	}

	@Override
	public void setRequestContext(RequestContext requestContext) {
		this.requestContur.setRequestContext(requestContext);
		
	}
	
	@Override
	public RequestContext CreateRequest(String subjectID, 
										String resID,
										String action, 
										String roleGroup) {
		return this.xacmlRequest.CreateRequest(subjectID, resID, action, roleGroup);
	}
	
	@Override
	public RequestContext CreateRequest(String subjectID, 
										String[] resID,
										String action, 
										String roleGroup) {
		return this.xacmlRequest.CreateRequest(subjectID, resID, action, roleGroup);
	}
	
	@Override
	public RequestContext CreateRequestAttrList(String subjectID,
												String[] resID, 
												String action, 
												String roleGroup) {

		return this.xacmlRequest.CreateRequestAttrList(subjectID, resID, action, roleGroup);
	}
	
	@Override
	public RequestContext[] CreateListRequest(String subjectID, 
											String[] resID,
											String action, 
											String roleGroup) {
		return this.xacmlRequest.CreateListRequest(subjectID, resID, action, roleGroup);
	}

	@Override
	public RequestContext[] flexibleRequestContext() throws Exception {
		return this.requestContur.flexibleRequestContext();
	}
	@Override
	public RequestContext strictRequestContext()
			throws Exception {
		return this.requestContur.strictRequestContext();
	}

}